#!/bin/bash

US="imarkket"
DB="imarkket"
PA="imarkket"
OU="/opt/lampp/htdocs/www/app-imarkket/mysql"
BI="/opt/lampp/bin/./mysqldump"
 
dbases=`/opt/lampp/bin/./mysql --user=$US --password=$PA -e "SHOW DATABASES;" | tr -d "| " | grep -v Database` 
 
for db in $dbases; do
    if [[ "$db" != "information_schema" ]] && [[ "$db" != _* ]] ; then
        if [[ "$db" == "imarkket" ]] ; then
          echo "Dumping database: $db"
          $BI --force --opt --user=$US --password=$PA --databases $db > $OU/export_${DB}_`date +%Y%m`.sql
          #gzip $OU/${DB}_`date +%Y%m%d%H%M%I`.sql
        fi
    fi
done
